import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useBreadsStore = defineStore('bread', () => {
  const breadCrumbs = ref([])

  function setBreadCrumbs(bread) {
    breadCrumbs.value = bread
    // breadCrumbs.value = bread.split('/')  // 根据路由路径生成面包屑数组，已废弃
    // .filter(Boolean)
    // .map((v, i, arr) => ({ key: i, val: v, path: '/' + arr.slice(0, i + 1).join('/') }))

  }

  return { breadCrumbs, setBreadCrumbs }
})